<!DOCTYPE html>
<html lang="zh" dir="ltr" class="client-nojs">
<head>
<title>日期和时间工具</title>
<meta charset="UTF-8">
<meta name="generator" content="MediaWiki 1.21.2">
<link rel="shortcut icon" href="../../common/favicon.ico">
<link rel="stylesheet" href="../../common/ext.css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" href="../../common/site_modules.css">
<style>a:lang(ar),a:lang(ckb),a:lang(fa),a:lang(kk-arab),a:lang(mzn),a:lang(ps),a:lang(ur){text-decoration:none}#toc{display:none}.editsection{display:none}
/* cache key: mwiki1-mwiki_zh_:resourceloader:filter:minify-css:7:15cea3ec788a65b5187d4018eed543bf */</style>

<script src="../../common/startup_scripts.js"></script>
<script>if(window.mw){
mw.config.set({"wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"cpp/chrono","wgTitle":"cpp/chrono","wgCurRevisionId":65284,"wgArticleId":908,"wgIsArticle":true,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":[],"wgBreakFrames":false,"wgPageContentLanguage":"zh","wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"zh","wgMonthNames":["","1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],"wgMonthNamesShort":["","1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],"wgRelevantPageName":"cpp/chrono","wgUserVariant":"zh","wgRestrictionEdit":[],"wgRestrictionMove":[]});
}</script><script>if(window.mw){
mw.loader.implement("user.options",function(){mw.user.options.set({"ccmeonemails":0,"cols":80,"date":"default","diffonly":0,"disablemail":0,"disablesuggest":0,"editfont":"default","editondblclick":0,"editsection":0,"editsectiononrightclick":0,"enotifminoredits":0,"enotifrevealaddr":0,"enotifusertalkpages":1,"enotifwatchlistpages":0,"extendwatchlist":0,"externaldiff":0,"externaleditor":0,"fancysig":0,"forceeditsummary":0,"gender":"unknown","hideminor":0,"hidepatrolled":0,"imagesize":2,"justify":0,"math":1,"minordefault":0,"newpageshidepatrolled":0,"nocache":0,"noconvertlink":0,"norollbackdiff":0,"numberheadings":0,"previewonfirst":0,"previewontop":1,"quickbar":5,"rcdays":7,"rclimit":50,"rememberpassword":0,"rows":25,"searchlimit":20,"showhiddencats":0,"showjumplinks":1,"shownumberswatching":1,"showtoc":0,"showtoolbar":1,"skin":"cppreference2","stubthreshold":0,"thumbsize":2,"underline":2,"uselivepreview":0,"usenewrc":0,"watchcreations":0,"watchdefault":0,"watchdeletion":0,
"watchlistdays":3,"watchlisthideanons":0,"watchlisthidebots":0,"watchlisthideliu":0,"watchlisthideminor":0,"watchlisthideown":0,"watchlisthidepatrolled":0,"watchmoves":0,"wllimit":250,"variant":"zh","language":"zh","searchNs0":true,"searchNs1":false,"searchNs2":false,"searchNs3":false,"searchNs4":false,"searchNs5":false,"searchNs6":false,"searchNs7":false,"searchNs8":false,"searchNs9":false,"searchNs10":false,"searchNs11":false,"searchNs12":false,"searchNs13":false,"searchNs14":false,"searchNs15":false,"gadget-MathJax":1,"gadget-ColiruCompiler":1});;},{},{});mw.loader.implement("user.tokens",function(){mw.user.tokens.set({"editToken":"+\\","patrolToken":false,"watchToken":false});;},{},{});
/* cache key: mwiki1-mwiki_zh_:resourceloader:filter:minify-js:7:258d7cd6aa9aa67dee25e01fb6a9e505 */
}</script>
<script>if(window.mw){
mw.loader.load(["mediawiki.page.startup","mediawiki.legacy.wikibits","mediawiki.legacy.ajax"]);
}</script>
<style type="text/css">/*<![CDATA[*/
.source-cpp {line-height: normal;}
.source-cpp li, .source-cpp pre {
	line-height: normal; border: 0px none white;
}
/**
 * GeSHi Dynamically Generated Stylesheet
 * --------------------------------------
 * Dynamically generated stylesheet for cpp
 * CSS class: source-cpp, CSS id: 
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 * --------------------------------------
 */
.cpp.source-cpp .de1, .cpp.source-cpp .de2 {font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;}
.cpp.source-cpp  {font-family:monospace;}
.cpp.source-cpp .imp {font-weight: bold; color: red;}
.cpp.source-cpp li, .cpp.source-cpp .li1 {font-weight: normal; vertical-align:top;}
.cpp.source-cpp .ln {width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;}
.cpp.source-cpp .li2 {font-weight: bold; vertical-align:top;}
.cpp.source-cpp .kw1 {color: #0000dd;}
.cpp.source-cpp .kw2 {color: #0000ff;}
.cpp.source-cpp .kw3 {color: #0000dd;}
.cpp.source-cpp .kw4 {color: #0000ff;}
.cpp.source-cpp .co1 {color: #909090;}
.cpp.source-cpp .co2 {color: #339900;}
.cpp.source-cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp.source-cpp .es0 {color: #008000; font-weight: bold;}
.cpp.source-cpp .es1 {color: #008000; font-weight: bold;}
.cpp.source-cpp .es2 {color: #008000; font-weight: bold;}
.cpp.source-cpp .es3 {color: #008000; font-weight: bold;}
.cpp.source-cpp .es4 {color: #008000; font-weight: bold;}
.cpp.source-cpp .es5 {color: #008000; font-weight: bold;}
.cpp.source-cpp .br0 {color: #008000;}
.cpp.source-cpp .sy0 {color: #008000;}
.cpp.source-cpp .sy1 {color: #000080;}
.cpp.source-cpp .sy2 {color: #000040;}
.cpp.source-cpp .sy3 {color: #000040;}
.cpp.source-cpp .sy4 {color: #008080;}
.cpp.source-cpp .st0 {color: #008000;}
.cpp.source-cpp .nu0 {color: #000080;}
.cpp.source-cpp .nu6 {color: #000080;}
.cpp.source-cpp .nu8 {color: #000080;}
.cpp.source-cpp .nu12 {color: #000080;}
.cpp.source-cpp .nu16 {color:#000080;}
.cpp.source-cpp .nu17 {color:#000080;}
.cpp.source-cpp .nu18 {color:#000080;}
.cpp.source-cpp .nu19 {color:#000080;}
.cpp.source-cpp .ln-xtra, .cpp.source-cpp li.ln-xtra, .cpp.source-cpp div.ln-xtra {background-color: #ffc;}
.cpp.source-cpp span.xtra { display:block; }

/*]]>*/
</style><style type="text/css">/*<![CDATA[*/
.source-text {line-height: normal;}
.source-text li, .source-text pre {
	line-height: normal; border: 0px none white;
}
/**
 * GeSHi Dynamically Generated Stylesheet
 * --------------------------------------
 * Dynamically generated stylesheet for text
 * CSS class: source-text, CSS id: 
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 * --------------------------------------
 */
.text.source-text .de1, .text.source-text .de2 {font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;}
.text.source-text  {font-family:monospace;}
.text.source-text .imp {font-weight: bold; color: red;}
.text.source-text li, .text.source-text .li1 {font-weight: normal; vertical-align:top;}
.text.source-text .ln {width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;}
.text.source-text .li2 {font-weight: bold; vertical-align:top;}
.text.source-text .ln-xtra, .text.source-text li.ln-xtra, .text.source-text div.ln-xtra {background-color: #ffc;}
.text.source-text span.xtra { display:block; }

/*]]>*/
</style><!--[if lt IE 7]><style type="text/css">body{behavior:url("/mwiki/skins/cppreference2/csshover.min.htc")}</style><![endif]--></head>
<body class="mediawiki ltr sitedir-ltr ns-0 ns-subject page-cpp_chrono skin-cppreference2 action-view cpp-navbar">
        <!-- header -->
        <!-- /header -->
        <!-- content -->
<div id="cpp-content-base">
            <div id="content">
                <a id="top"></a>
                <div id="mw-js-message" style="display:none;"></div>
                                <!-- firstHeading -->
<h1 id="firstHeading" class="firstHeading">日期和时间工具</h1>
                <!-- /firstHeading -->
                <!-- bodyContent -->
                <div id="bodyContent">
                                        <!-- tagline -->
                    <div id="siteSub">来自cppreference.com</div>
                    <!-- /tagline -->
                                        <!-- subtitle -->
                    <div id="contentSub"><span class="subpages">&lt; <a href="../cpp.html" title="cpp">cpp</a></span></div>
                    <!-- /subtitle -->
                                                            <!-- bodycontent -->
                    <div id="mw-content-text" lang="zh" dir="ltr" class="mw-content-ltr"><div class="t-navbar" style=""><div class="t-navbar-sep"> </div><div class="t-navbar-head"><a href="../cpp.html" title="cpp"> C++</a><div class="t-navbar-menu"><div><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em;">
<tr class="t-nv"><td colspan="5"> <a href="language.html" title="cpp/language">语言</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="header.html" title="cpp/header">标准库头文件</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="freestanding.html" title="cpp/freestanding"> 自立与有宿主实现</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="named_req.html" title="cpp/named req">具名要求</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="utility.html#.E8.AF.AD.E8.A8.80.E6.94.AF.E6.8C.81" title="cpp/utility">语言支持库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="concepts.html" title="cpp/concepts">概念库</a> <span class="t-mark-rev t-since-cxx20">(C++20)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="error.html" title="cpp/error">诊断库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="utility.html" title="cpp/utility">工具库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="string.html" title="cpp/string">字符串库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="https://zh.cppreference.com/w/cpp/container" title="cpp/container">容器库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="iterator.html" title="cpp/iterator">迭代器库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="ranges.html" title="cpp/ranges"> 范围库</a> <span class="t-mark-rev t-since-cxx20">(C++20)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="algorithm.html" title="cpp/algorithm">算法库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="numeric.html" title="cpp/numeric">数值库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="io.html" title="cpp/io">输入/输出库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="locale.html" title="cpp/locale">本地化库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="regex.html" title="cpp/regex">正则表达式库</a> <span class="t-mark-rev t-since-cxx11">(C++11)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="atomic.html" title="cpp/atomic">原子操作库</a> <span class="t-mark-rev t-since-cxx11">(C++11)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="thread.html" title="cpp/thread">线程支持库</a> <span class="t-mark-rev t-since-cxx11">(C++11)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="filesystem.html" title="cpp/filesystem">文件系统库</a> <span class="t-mark-rev t-since-cxx17">(C++17)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="experimental.html" title="cpp/experimental">技术规范</a> </td></tr>
</table></div><div></div></div></div></div><div class="t-navbar-sep"> </div><div class="t-navbar-head"><a href="utility.html" title="cpp/utility">工具库</a><div class="t-navbar-menu"><div><div><table class="t-nv-begin" cellpadding="0" style="">
<tr class="t-nv"><td colspan="5"> <a href="types.html" title="cpp/types">类型支持</a>（基本类型、 RTTI 、类型特性）</td></tr>
<tr class="t-nv"><td colspan="5"> <a href="memory.html" title="cpp/memory">动态内存管理</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="error.html" title="cpp/error">错误处理</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="utility/program.html" title="cpp/utility/program">程序工具</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="utility/variadic.html" title="cpp/utility/variadic">变参数函数</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="utility/feature_test.html" title="cpp/utility/feature test">库特性测试宏</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <strong class="selflink">日期和时间</strong> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="utility/functional.html" title="cpp/utility/functional">函数对象</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="utility/format.html" title="cpp/utility/format"> 格式化库</a> <span class="t-mark-rev t-since-cxx20">(C++20)</span> </td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/initializer_list.html" title="cpp/utility/initializer list"><span class="t-lines"><span>initializer_list</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/source_location.html" title="cpp/utility/source location"><span class="t-lines"><span>source_location</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/bitset.html" title="cpp/utility/bitset"><span class="t-lines"><span>bitset</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/hash.html" title="cpp/utility/hash"><span class="t-lines"><span>hash</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/integer_sequence.html" title="cpp/utility/integer sequence"><span class="t-lines"><span>integer_sequence</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx14">(C++14)</span></span></span></div></div></td></tr>
<tr class="t-nv-h2"><td colspan="5"> 关系运算符 <span class="t-mark-rev t-deprecated-cxx20">(C++20 中弃用)</span> </td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/rel_ops/operator_cmp.html" title="cpp/utility/rel ops/operator cmp"><span class="t-lines"><span>rel_ops::operator!=</span><span>rel_ops::operator&gt;</span><span>rel_ops::operator&lt;=</span><span>rel_ops::operator&gt;=</span></span></a></div></div></td></tr>
<tr class="t-nv-h2"><td colspan="5"> 比较 <span class="t-mark-rev t-since-cxx20">(C++20)</span></td></tr><tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/compare/three_way_comparable.html" title="cpp/utility/compare/three way comparable"><span class="t-lines"><span>three_way_comparable</span><span>three_way_comparable_with</span></span></a></div></div></td></tr>
<tr class="t-nv-col-table"><td><div><table class="t-nv-begin" cellpadding="0" style="">
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/compare/strong_ordering.html" title="cpp/utility/compare/strong ordering"><span class="t-lines"><span>strong_ordering</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/compare/weak_ordering.html" title="cpp/utility/compare/weak ordering"><span class="t-lines"><span>weak_ordering</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/compare/partial_ordering.html" title="cpp/utility/compare/partial ordering"><span class="t-lines"><span>partial_ordering</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/compare/common_comparison_category.html" title="cpp/utility/compare/common comparison category"><span class="t-lines"><span>common_comparison_category</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/compare/compare_three_way_result.html" title="cpp/utility/compare/compare three way result"><span class="t-lines"><span>compare_three_way_result</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/compare/compare_three_way.html" title="cpp/utility/compare/compare three way"><span class="t-lines"><span>compare_three_way</span></span></a></div></div></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="">
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/compare/strong_order.html" title="cpp/utility/compare/strong order"><span class="t-lines"><span>strong_order</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/compare/weak_order.html" title="cpp/utility/compare/weak order"><span class="t-lines"><span>weak_order</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/compare/partial_order.html" title="cpp/utility/compare/partial order"><span class="t-lines"><span>partial_order</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/compare/compare_strong_order_fallback.html" title="cpp/utility/compare/compare strong order fallback"><span class="t-lines"><span>compare_strong_order_fallback</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/compare/compare_weak_order_fallback.html" title="cpp/utility/compare/compare weak order fallback"><span class="t-lines"><span>compare_weak_order_fallback</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/compare/compare_partial_order_fallback.html" title="cpp/utility/compare/compare partial order fallback"><span class="t-lines"><span>compare_partial_order_fallback</span></span></a></div></div></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="">
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/compare/named_comparison_functions.html" title="cpp/utility/compare/named comparison functions"><span class="t-lines"><span>is_eq</span><span>is_neq</span><span>is_lt</span><span>is_lteq</span><span>is_gt</span><span>is_gteq</span></span></a></div></div></td></tr>
</table></div></td></tr>
<tr class="t-nv-h2"><td colspan="5"> 共用词汇类型</td></tr>
<tr class="t-nv-col-table"><td><div><table class="t-nv-begin" cellpadding="0" style="">
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/pair.html" title="cpp/utility/pair"><span class="t-lines"><span>pair</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/tuple.html" title="cpp/utility/tuple"><span class="t-lines"><span>tuple</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/apply.html" title="cpp/utility/apply"><span class="t-lines"><span>apply</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx17">(C++17)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/make_from_tuple.html" title="cpp/utility/make from tuple"><span class="t-lines"><span>make_from_tuple</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx17">(C++17)</span></span></span></div></div></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="">
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/optional.html" title="cpp/utility/optional"><span class="t-lines"><span>optional</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx17">(C++17)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/any.html" title="cpp/utility/any"><span class="t-lines"><span>any</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx17">(C++17)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/variant.html" title="cpp/utility/variant"><span class="t-lines"><span>variant</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx17">(C++17)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"> <br>
</td></tr>
</table></div></td></tr>
<tr class="t-nv-h2"><td colspan="5"> swap 、 forward 与 move</td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="algorithm/swap.html" title="cpp/algorithm/swap"><span class="t-lines"><span>swap</span></span></a></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/exchange.html" title="cpp/utility/exchange"><span class="t-lines"><span>exchange</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx14">(C++14)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/forward.html" title="cpp/utility/forward"><span class="t-lines"><span>forward</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/move.html" title="cpp/utility/move"><span class="t-lines"><span>move</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/move_if_noexcept.html" title="cpp/utility/move if noexcept"><span class="t-lines"><span>move_if_noexcept</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv-h2"><td colspan="5"> 初等字符串转换</td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/to_chars.html" title="cpp/utility/to chars"><span class="t-lines"><span>to_chars</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx17">(C++17)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/from_chars.html" title="cpp/utility/from chars"><span class="t-lines"><span>from_chars</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx17">(C++17)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/chars_format.html" title="cpp/utility/chars format"><span class="t-lines"><span>chars_format</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx17">(C++17)</span></span></span></div></div></td></tr>
<tr class="t-nv-h2"><td colspan="5"> 类型运算</td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/declval.html" title="cpp/utility/declval"><span class="t-lines"><span>declval</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/as_const.html" title="cpp/utility/as const"><span class="t-lines"><span>as_const</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx17">(C++17)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="utility/launder.html" title="cpp/utility/launder"><span class="t-lines"><span>launder</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx17">(C++17)</span></span></span></div></div></td></tr>
</table></div><div></div></div></div></div><div class="t-navbar-sep"> </div><div class="t-navbar-head"><strong class="selflink">日期和时间工具</strong><div class="t-navbar-menu"><div><div><table class="t-nv-begin" cellpadding="0" style="">
<tr class="t-nv-col-table"><td><div><table class="t-nv-begin" cellpadding="0" style="">
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/duration.html" title="cpp/chrono/duration"><span class="t-lines"><span>duration</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/time_point.html" title="cpp/chrono/time point"><span class="t-lines"><span>time_point</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/time_of_day.html" title="cpp/chrono/time of day"><span class="t-lines"><span>time_of_day</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="">
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/clock_time_conversion.html" title="cpp/chrono/clock time conversion"><span class="t-lines"><span>clock_time_conversion</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/clock_cast.html" title="cpp/chrono/clock cast"><span class="t-lines"><span>clock_cast</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"> <br>
</td></tr>
</table></div></td></tr>
<tr class="t-nv-h2"><td colspan="5"> 时钟</td></tr>
<tr class="t-nv-col-table"><td><div><table class="t-nv-begin" cellpadding="0" style="">
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/system_clock.html" title="cpp/chrono/system clock"><span class="t-lines"><span>system_clock</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/steady_clock.html" title="cpp/chrono/steady clock"><span class="t-lines"><span>steady_clock</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/high_resolution_clock.html" title="cpp/chrono/high resolution clock"><span class="t-lines"><span>high_resolution_clock</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/is_clock.html" title="cpp/chrono/is clock"><span class="t-lines"><span>is_clock</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5">                                             </td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="">
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/utc_clock.html" title="cpp/chrono/utc clock"><span class="t-lines"><span>utc_clock</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/tai_clock.html" title="cpp/chrono/tai clock"><span class="t-lines"><span>tai_clock</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/gps_clock.html" title="cpp/chrono/gps clock"><span class="t-lines"><span>gps_clock</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/file_clock.html" title="cpp/chrono/file clock"><span class="t-lines"><span>file_clock</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/local_t.html" title="cpp/chrono/local t"><span class="t-lines"><span>local_t</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
</table></div></td></tr>
<tr class="t-nv-h2"><td colspan="5"> 日历</td></tr>
<tr class="t-nv-col-table"><td><div><table class="t-nv-begin" cellpadding="0" style="">
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/day.html" title="cpp/chrono/day"><span class="t-lines"><span>day</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/month.html" title="cpp/chrono/month"><span class="t-lines"><span>month</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/year.html" title="cpp/chrono/year"><span class="t-lines"><span>year</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/weekday.html" title="cpp/chrono/weekday"><span class="t-lines"><span>weekday</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/operator_slash.html" title="cpp/chrono/operator slash"><span class="t-lines"><span>operator/</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/year_month_day.html" title="cpp/chrono/year month day"><span class="t-lines"><span>year_month_day</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/year_month_day_last.html" title="cpp/chrono/year month day last"><span class="t-lines"><span>year_month_day_last</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/year_month_weekday.html" title="cpp/chrono/year month weekday"><span class="t-lines"><span>year_month_weekday</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/year_month_weekday_last.html" title="cpp/chrono/year month weekday last"><span class="t-lines"><span>year_month_weekday_last</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="">
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/weekday_indexed.html" title="cpp/chrono/weekday indexed"><span class="t-lines"><span>weekday_indexed</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/weekday_last.html" title="cpp/chrono/weekday last"><span class="t-lines"><span>weekday_last</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"> <br>
</td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/month_day.html" title="cpp/chrono/month day"><span class="t-lines"><span>month_day</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/month_day_last.html" title="cpp/chrono/month day last"><span class="t-lines"><span>month_day_last</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/month_weekday.html" title="cpp/chrono/month weekday"><span class="t-lines"><span>month_weekday</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/month_weekday_last.html" title="cpp/chrono/month weekday last"><span class="t-lines"><span>month_weekday_last</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"> <br>
</td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/year_month.html" title="cpp/chrono/year month"><span class="t-lines"><span>year_month</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
</table></div></td></tr>
<tr class="t-nv-h2"><td colspan="5"> 时区</td></tr>
<tr class="t-nv-col-table"><td><div><table class="t-nv-begin" cellpadding="0" style="">
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/tzdb.html" title="cpp/chrono/tzdb"><span class="t-lines"><span>tzdb</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/tzdb_list.html" title="cpp/chrono/tzdb list"><span class="t-lines"><span>tzdb_list</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/tzdb_functions.html" title="cpp/chrono/tzdb functions"><span class="t-lines"><span>get_tzdb</span><span>get_tzdb_list</span><span>reload_tzdb</span><span>remote_version</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="">
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/time_zone.html" title="cpp/chrono/time zone"><span class="t-lines"><span>time_zone</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/locate_zone.html" title="cpp/chrono/locate zone"><span class="t-lines"><span>locate_zone</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/current_zone.html" title="cpp/chrono/current zone"><span class="t-lines"><span>current_zone</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/zoned_time.html" title="cpp/chrono/zoned time"><span class="t-lines"><span>zoned_time</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/link.html" title="cpp/chrono/link"><span class="t-lines"><span>link</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
<tr class="t-nv"><td colspan="5"><div class="t-nv-ln-table"><div><a href="chrono/leap.html" title="cpp/chrono/leap"><span class="t-lines"><span>leap</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div></td></tr>
</table></div></td></tr>
<tr class="t-nv-h2"><td colspan="5"> <a href="chrono/c.html" title="cpp/chrono/c"> C 风格日期和时间</a></td></tr>
</table></div><div></div></div></div></div><div class="t-navbar-sep"> </div></div>
<p>C++ 包含对二类时间操作的支持：
</p>
<ul><li> <code>chrono</code> 库，以各种精度跟踪时间的类型的灵活汇集（如 <span class="t-lc"><a href="chrono/time_point.html" title="cpp/chrono/time point">std::chrono::time_point</a></span> ）。
</li><li> C 风格日期和时间工具（如 <span class="t-lc"><a href="chrono/c/time.html" title="cpp/chrono/c/time">std::time</a></span> ）。
</li></ul>
<h3><span class="mw-headline" id="std::chrono_.E5.BA.93"><a href="header/chrono.html" title="cpp/header/chrono"><code>std::chrono</code> 库</a></span></h3>
<p><code>chrono</code> 库定义三种主要类型以及工具函数和常用 typedef 。
</p>
<ul><li>时钟
</li><li>时长
</li><li>时间点
</li></ul>
<h4><span class="mw-headline" id=".E6.97.B6.E9.92.9F">时钟</span></h4>
<p>时钟由起点（或纪元）及计次频率组成。例如，时钟可以拥有 1970 年 1 月 1 日的纪元，和每一秒的计次。 C++ 定义数种时钟类型：
</p>
<table class="t-dsc-begin">

<tr class="t-dsc-header">
<td colspan="2"> <div>定义于头文件 <code>&lt;chrono&gt;</code> </div>
</td></tr>

<tr class="t-dsc-header">
<td colspan="2"> <div>定义于命名空间 <code>std::chrono</code></div>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/system_clock.html" title="cpp/chrono/system clock"> <span class="t-lines"><span>system_clock</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>  来自系统范畴实时时钟的挂钟时间 <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/steady_clock.html" title="cpp/chrono/steady clock"> <span class="t-lines"><span>steady_clock</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>  决不会调整的单调时钟 <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/high_resolution_clock.html" title="cpp/chrono/high resolution clock"> <span class="t-lines"><span>high_resolution_clock</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>  拥有可用的最短嘀嗒周期的时钟 <br> <span class="t-mark">(类)</span> </td></tr>


<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/is_clock.html" title="cpp/chrono/is clock"> <span class="t-lines"><span>is_clock</span><span>is_clock_v</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  确定类型是否为<a href="named_req/Clock.html" title="cpp/named req/Clock"><i>时钟</i> <span style="font-family: Georgia, 'DejaVu Serif', serif; font-style:italic">(Clock)</span> </a>  <br> <span class="t-mark">(类模板)</span> <span class="t-mark">(变量模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/utc_clock.html" title="cpp/chrono/utc clock"> <span class="t-lines"><span>utc_clock</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  协调世界时 (UTC) 的<a href="named_req/Clock.html" title="cpp/named req/Clock"><i>时钟</i> <span style="font-family: Georgia, 'DejaVu Serif', serif; font-style:italic">(Clock)</span> </a> <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/tai_clock.html" title="cpp/chrono/tai clock"> <span class="t-lines"><span>tai_clock</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  国际原子时 (TAI) 的<a href="named_req/Clock.html" title="cpp/named req/Clock"><i>时钟</i> <span style="font-family: Georgia, 'DejaVu Serif', serif; font-style:italic">(Clock)</span> </a> <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/gps_clock.html" title="cpp/chrono/gps clock"> <span class="t-lines"><span>gps_clock</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  GPS 时间的<a href="named_req/Clock.html" title="cpp/named req/Clock"><i>时钟</i> <span style="font-family: Georgia, 'DejaVu Serif', serif; font-style:italic">(Clock)</span> </a> <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/file_clock.html" title="cpp/chrono/file clock"> <span class="t-lines"><span>file_clock</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  用于<a href="filesystem/file_time_type.html" title="cpp/filesystem/file time type">文件时间</a>的<a href="named_req/Clock.html" title="cpp/named req/Clock"><i>时钟</i> <span style="font-family: Georgia, 'DejaVu Serif', serif; font-style:italic">(Clock)</span> </a> <br> <span class="t-mark">(typedef)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/local_t.html" title="cpp/chrono/local t"> <span class="t-lines"><span>local_t</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  表示本地时间的伪时钟 <br> <span class="t-mark">(类)</span> </td></tr>
</table>
<h4><span class="mw-headline" id=".E6.97.B6.E9.97.B4.E7.82.B9">时间点</span></h4>
<p>时间点是从特定时钟的纪元开始经过的时间时长。
</p>
<table class="t-dsc-begin">

<tr class="t-dsc-header">
<td colspan="2"> <div>定义于头文件 <code>&lt;chrono&gt;</code> </div>
</td></tr>

<tr class="t-dsc-header">
<td colspan="2"> <div>定义于命名空间 <code>std::chrono</code></div>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/time_point.html" title="cpp/chrono/time point"> <span class="t-lines"><span>time_point</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>  时间中的点 <br> <span class="t-mark">(类模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/clock_time_conversion.html" title="cpp/chrono/clock time conversion"> <span class="t-lines"><span>clock_time_conversion</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  定义如何转换一个时钟的时间点为另一个的特性类 <br> <span class="t-mark">(类模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/clock_cast.html" title="cpp/chrono/clock cast"> <span class="t-lines"><span>clock_cast</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  转换一个时钟的时间点为另一个 <br> <span class="t-mark">(函数模板)</span> </td></tr>
</table>
<h4><span class="mw-headline" id=".E6.97.B6.E9.95.BF">时长</span></h4>
<p>时长由时间跨度组成，定义为某时间单位的某个计次数。例如，“ 42 秒”可表示为由 42 个 1 秒时间点位的计次所组成的时长。
</p>
<table class="t-dsc-begin">

<tr class="t-dsc-header">
<td colspan="2"> <div>定义于头文件 <code>&lt;chrono&gt;</code> </div>
</td></tr>

<tr class="t-dsc-header">
<td colspan="2"> <div>定义于命名空间 <code>std::chrono</code></div>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/duration.html" title="cpp/chrono/duration"> <span class="t-lines"><span>duration</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>  时间区间 <br> <span class="t-mark">(类模板)</span> </td></tr>
</table>
<h4><span class="mw-headline" id=".E5.BD.93.E5.A4.A9.E6.97.B6.E5.88.BB">当天时刻</span></h4>
<p><code>time_of_day</code> 尽可能地将表示自午夜起经过的时长分割成时、分、秒和秒的小数部分。它主要是一个格式化工具。
</p>
<table class="t-dsc-begin">

<tr class="t-dsc-header">
<td colspan="2"> <div>定义于头文件 <code>&lt;chrono&gt;</code> </div>
</td></tr>

<tr class="t-dsc-header">
<td colspan="2"> <div>定义于命名空间 <code>std::chrono</code></div>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/time_of_day.html" title="cpp/chrono/time of day"> <span class="t-lines"><span>time_of_day</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  表示一日中的时间 <br> <span class="t-mark">(类模板)</span> </td></tr>
</table>
<h4><span class="mw-headline" id=".E6.97.A5.E5.8E.86">日历</span></h4>
<table class="t-dsc-begin">

<tr class="t-dsc-header">
<td colspan="2"> <div>定义于头文件 <code>&lt;chrono&gt;</code> </div>
</td></tr>

<tr class="t-dsc-header">
<td colspan="2"> <div>定义于命名空间 <code>std::chrono</code></div>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/last_spec.html" title="cpp/chrono/last spec"> <span class="t-lines"><span>last_spec</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  指示一个月中<i>最后</i>日期或星期的标签类 <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/day.html" title="cpp/chrono/day"> <span class="t-lines"><span>day</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  表示月之日期 <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/month.html" title="cpp/chrono/month"> <span class="t-lines"><span>month</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  表示年之月份 <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/year.html" title="cpp/chrono/year"> <span class="t-lines"><span>year</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  表示格里高利历中的年 <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/weekday.html" title="cpp/chrono/weekday"> <span class="t-lines"><span>weekday</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  表示格里高利历中星期之日 <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/weekday_indexed.html" title="cpp/chrono/weekday indexed"> <span class="t-lines"><span>weekday_indexed</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  表示月份的第 n 个 <a href="chrono/weekday.html" title="cpp/chrono/weekday"><tt>weekday</tt></a> <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/weekday_last.html" title="cpp/chrono/weekday last"> <span class="t-lines"><span>weekday_last</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  表示月份的最后一个 <a href="chrono/weekday.html" title="cpp/chrono/weekday"><tt>weekday</tt></a> <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/month_day.html" title="cpp/chrono/month day"> <span class="t-lines"><span>month_day</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  表示特定 <a href="chrono/month.html" title="cpp/chrono/month"><tt>month</tt></a> 的特定 <a href="chrono/day.html" title="cpp/chrono/day"><tt>day</tt></a> <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/month_day_last.html" title="cpp/chrono/month day last"> <span class="t-lines"><span>month_day_last</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  表示特定 <a href="chrono/month.html" title="cpp/chrono/month"><tt>month</tt></a> 的最后一日 <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/month_weekday.html" title="cpp/chrono/month weekday"> <span class="t-lines"><span>month_weekday</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  表示特定 <a href="chrono/month.html" title="cpp/chrono/month"><tt>month</tt></a> 的第 n 个 <a href="chrono/weekday.html" title="cpp/chrono/weekday"><tt>weekday</tt></a> <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/month_weekday_last.html" title="cpp/chrono/month weekday last"> <span class="t-lines"><span>month_weekday_last</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  表示特定 <a href="chrono/month.html" title="cpp/chrono/month"><tt>month</tt></a> 的最后一个 <a href="chrono/weekday.html" title="cpp/chrono/weekday"><tt>weekday</tt></a> <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/year_month.html" title="cpp/chrono/year month"> <span class="t-lines"><span>year_month</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  表示特定 <a href="chrono/year.html" title="cpp/chrono/year"><tt>year</tt></a> 的特定 <a href="chrono/month.html" title="cpp/chrono/month"><tt>month</tt></a> <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/year_month_day.html" title="cpp/chrono/year month day"> <span class="t-lines"><span>year_month_day</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  表示特定的 <a href="chrono/year.html" title="cpp/chrono/year"><tt>year</tt></a> 、 <a href="chrono/month.html" title="cpp/chrono/month"><tt>month</tt></a> 和 <a href="chrono/day.html" title="cpp/chrono/day"><tt>day</tt></a>  <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/year_month_day_last.html" title="cpp/chrono/year month day last"> <span class="t-lines"><span>year_month_day_last</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  表示特定 <a href="chrono/year.html" title="cpp/chrono/year"><tt>year</tt></a> 和 <a href="chrono/month.html" title="cpp/chrono/month"><tt>month</tt></a> 的最后一日 <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/year_month_weekday.html" title="cpp/chrono/year month weekday"> <span class="t-lines"><span>year_month_weekday</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  表示特定 <a href="chrono/year.html" title="cpp/chrono/year"><tt>year</tt></a> 和 <a href="chrono/month.html" title="cpp/chrono/month"><tt>month</tt></a> 的第 n 个 <a href="chrono/weekday.html" title="cpp/chrono/weekday"><tt>weekday</tt></a> <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/year_month_weekday_last.html" title="cpp/chrono/year month weekday last"> <span class="t-lines"><span>year_month_weekday_last</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  表示特定 <a href="chrono/year.html" title="cpp/chrono/year"><tt>year</tt></a> 和 <a href="chrono/month.html" title="cpp/chrono/month"><tt>month</tt></a> 的最后一个 <a href="chrono/weekday.html" title="cpp/chrono/weekday"><tt>weekday</tt></a> <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/operator_slash.html" title="cpp/chrono/operator slash"> <span class="t-lines"><span>operator/</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  创建格里高利历日期的约定语法 <br> <span class="t-mark">(函数)</span> </td></tr>
</table>
<h4><span class="mw-headline" id=".E6.97.B6.E5.8C.BA">时区</span></h4>
<table class="t-dsc-begin">

<tr class="t-dsc-header">
<td colspan="2"> <div>定义于头文件 <code>&lt;chrono&gt;</code> </div>
</td></tr>

<tr class="t-dsc-header">
<td colspan="2"> <div>定义于命名空间 <code>std::chrono</code></div>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/tzdb.html" title="cpp/chrono/tzdb"> <span class="t-lines"><span>tzdb</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  描述 IANA 时区数据库的副本 <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/tzdb_list.html" title="cpp/chrono/tzdb list"> <span class="t-lines"><span>tzdb_list</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  表示 <a href="chrono/tzdb.html" title="cpp/chrono/tzdb"><tt>tzdb</tt></a> 的链表 <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/tzdb_functions.html" title="cpp/chrono/tzdb functions"> <span class="t-lines"><span>get_tzdb</span><span>get_tzdb_list</span><span>reload_tzdb</span><span>remote_version</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  访问和控制全球时区数据库信息 <br> <span class="t-mark">(函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/locate_zone.html" title="cpp/chrono/locate zone"> <span class="t-lines"><span>locate_zone</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  定位基于其名称的 <a href="chrono/time_zone.html" title="cpp/chrono/time zone"><tt>time_zone</tt></a> <br> <span class="t-mark">(函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/current_zone.html" title="cpp/chrono/current zone"> <span class="t-lines"><span>current_zone</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  返回当前的 <a href="chrono/time_zone.html" title="cpp/chrono/time zone"><tt>time_zone</tt></a> <br> <span class="t-mark">(函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/time_zone.html" title="cpp/chrono/time zone"> <span class="t-lines"><span>time_zone</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  表示时区 <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/sys_info.html" title="cpp/chrono/sys info"> <span class="t-lines"><span>sys_info</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  表示在特定时间点的关于时区的信息 <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/local_info.html" title="cpp/chrono/local info"> <span class="t-lines"><span>local_info</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  表示关于从本地时间转换到 UNIX 时间的信息 <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/choose.html" title="cpp/chrono/choose"> <span class="t-lines"><span>choose</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  选择应如何解析歧义的本地时间 <br> <span class="t-mark">(枚举)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/zoned_traits.html" title="cpp/chrono/zoned traits"> <span class="t-lines"><span>zoned_traits</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  <a href="chrono/zoned_time.html" title="cpp/chrono/zoned time"><tt>zoned_time</tt></a> 所用的时区指针的特性类 <br> <span class="t-mark">(类模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/zoned_time.html" title="cpp/chrono/zoned time"> <span class="t-lines"><span>zoned_time</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  表示时区和时间点 <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/leap.html" title="cpp/chrono/leap"> <span class="t-lines"><span>leap</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  含有关于插入闰秒的信息 <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/link.html" title="cpp/chrono/link"> <span class="t-lines"><span>link</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  表示时区的替用名 <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/nonexistent_local_time.html" title="cpp/chrono/nonexistent local time"> <span class="t-lines"><span>nonexistent_local_time</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  抛出以报告本地时间不存在的异常 <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/ambiguous_local_time.html" title="cpp/chrono/ambiguous local time"> <span class="t-lines"><span>ambiguous_local_time</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  抛出以报告本地时间有歧义的异常 <br> <span class="t-mark">(类)</span> </td></tr>
</table>
<h4><span class="mw-headline" id="chrono_I.2FO"> <code>chrono</code> I/O </span></h4>
<table class="t-dsc-begin">

<tr class="t-dsc-header">
<td colspan="2"> <div>定义于头文件 <code>&lt;chrono&gt;</code> </div>
</td></tr>

<tr class="t-dsc-header">
<td colspan="2"> <div>定义于命名空间 <code>std::chrono</code></div>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="chrono/parse.html" title="cpp/chrono/parse"> <span class="t-lines"><span>parse</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  从流分析 <code>chrono</code> 对象 <br> <span class="t-mark">(函数模板)</span> </td></tr>
</table>
<h3><span class="mw-headline" id="C_.E9.A3.8E.E6.A0.BC.E6.97.A5.E6.9C.9F.E4.B8.8E.E6.97.B6.E9.97.B4.E5.BA.93"><a href="chrono/c.html" title="cpp/chrono/c">C 风格日期与时间库</a></span></h3>
<p>亦提供 C 风格日期与时间函数，例如 <span class="t-lc"><a href="chrono/c/time_t.html" title="cpp/chrono/c/time t">std::time_t</a></span> 、 <span class="t-lc"><a href="chrono/c/difftime.html" title="cpp/chrono/c/difftime">std::difftime</a></span> 和 <span class="t-lc"><a href="chrono/c/CLOCKS_PER_SEC.html" title="cpp/chrono/c/CLOCKS PER SEC">CLOCKS_PER_SEC</a></span> 。
</p>
<h3><span class="mw-headline" id=".E7.A4.BA.E4.BE.8B">示例</span></h3>
<div class="t-example"><p>此示例显式关于函数调用执行时间的信息：</p><div class="t-example-live-link"><div class="coliru-btn coliru-btn-run-init">运行此代码</div></div>
<div dir="ltr" class="mw-geshi" style="text-align: left;"><div class="cpp source-cpp"><pre class="de1"><span class="co2">#include &lt;iostream&gt;</span>
<span class="co2">#include &lt;chrono&gt;</span>
 
<span class="kw4">long</span> fibonacci<span class="br0">(</span><span class="kw4">unsigned</span> n<span class="br0">)</span>
<span class="br0">{</span>
    <span class="kw1">if</span> <span class="br0">(</span>n <span class="sy1">&lt;</span> <span class="nu0">2</span><span class="br0">)</span> <span class="kw1">return</span> n<span class="sy4">;</span>
    <span class="kw1">return</span> fibonacci<span class="br0">(</span>n<span class="sy2">-</span><span class="nu0">1</span><span class="br0">)</span> <span class="sy2">+</span> fibonacci<span class="br0">(</span>n<span class="sy2">-</span><span class="nu0">2</span><span class="br0">)</span><span class="sy4">;</span>
<span class="br0">}</span>
 
<span class="kw4">int</span> main<span class="br0">(</span><span class="br0">)</span>
<span class="br0">{</span>
    <span class="kw4">auto</span> start <span class="sy1">=</span> std<span class="sy4">::</span><span class="me2">chrono</span><span class="sy4">::</span><span class="me2">steady_clock</span><span class="sy4">::</span><span class="me2">now</span><span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span>
    <a href="io/cout.html"><span class="kw1758">std::<span class="me2">cout</span></span></a> <span class="sy1">&lt;&lt;</span> <span class="st0">"f(42) = "</span> <span class="sy1">&lt;&lt;</span> fibonacci<span class="br0">(</span><span class="nu0">42</span><span class="br0">)</span> <span class="sy1">&lt;&lt;</span> <span class="st0">'<span class="es1">\n</span>'</span><span class="sy4">;</span>
    <span class="kw4">auto</span> end <span class="sy1">=</span> std<span class="sy4">::</span><span class="me2">chrono</span><span class="sy4">::</span><span class="me2">steady_clock</span><span class="sy4">::</span><span class="me2">now</span><span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span>
 
    <a href="io/cout.html"><span class="kw1758">std::<span class="me2">cout</span></span></a> <span class="sy1">&lt;&lt;</span> <span class="st0">"finished computation at "</span> <span class="sy1">&lt;&lt;</span> <a href="chrono/c/ctime.html"><span class="kw1016">std::<span class="me2">ctime</span></span></a><span class="br0">(</span><span class="sy3">&amp;</span>end_time<span class="br0">)</span>
              <span class="sy1">&lt;&lt;</span> <span class="st0">"elapsed time: "</span> <span class="sy1">&lt;&lt;</span> elapsed_seconds.<span class="me1">count</span><span class="br0">(</span><span class="br0">)</span> <span class="sy1">&lt;&lt;</span> <span class="st0">"s<span class="es1">\n</span>"</span><span class="sy4">;</span>
<span class="br0">}</span></pre></div></div>
<p>可能的输出：
</p>
<div dir="ltr" class="mw-geshi" style="text-align: left;"><div class="text source-text"><pre class="de1">f(42) = 267914296
elapsed time: 1.88232s</pre></div></div> 
</div>

<!-- 
NewPP limit report
Preprocessor visited node count: 14380/1000000
Preprocessor generated node count: 13017/1000000
Post‐expand include size: 461666/2097152 bytes
Template argument size: 86729/2097152 bytes
Highest expansion depth: 23/40
Expensive parser function count: 0/100
-->

<!-- Saved in parser cache with key mwiki1-mwiki_zh_:pcache:idhash:908-0!*!0!!zh!*!zh!* and timestamp 20200313071602 -->
</div>                    <!-- /bodycontent -->
                                        <!-- printfooter -->
                    <div class="printfooter">
                    来自“<a href="https://zh.cppreference.com/mwiki/index.php?title=cpp/chrono&amp;oldid=65284">https://zh.cppreference.com/mwiki/index.php?title=cpp/chrono&amp;oldid=65284</a>”                    </div>
                    <!-- /printfooter -->
                                                            <!-- catlinks -->
                    <!-- /catlinks -->
                                                            <div class="visualClear"></div>
                    <!-- debughtml -->
                                        <!-- /debughtml -->
                </div>
                <!-- /bodyContent -->
            </div>
        </div>
        <!-- /content -->
        <!-- footer -->
        <div id="cpp-footer-base" class="noprint">
            <div id="footer">
                        <div id="cpp-navigation">
            <h5>导航</h5>
            <ul><li><a href="https://zh.cppreference.com/w/cpp/chrono">Online version</a></li><li>Offline version retrieved 2020-03-14 18:00.</li></ul></div>
                        <ul id="footer-info">
                                    <li id="footer-info-lastmod"> 本页面最后修改于2020年3月13日 (星期五) 00:16。</li>
                                    <li id="footer-info-viewcount">此页面已被浏览过52,005次。</li>
                            </ul>
                    </div>
        </div>
        <!-- /footer -->
        <script>if(window.mw){
mw.loader.state({"site":"loading","user":"missing","user.groups":"ready"});
}</script>
<script src="../../common/skin_scripts.js"></script>
<script>if(window.mw){
mw.loader.load(["mediawiki.action.view.postEdit","mediawiki.user","mediawiki.page.ready","mediawiki.searchSuggest","mediawiki.hidpi","ext.gadget.MathJax","ext.gadget.ColiruCompiler"], null, true);
}</script>
<script src="../../common/site_scripts.js"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-2828341-1']);
_gaq.push(['_setDomainName', 'cppreference.com']);
_gaq.push(['_trackPageview']);
</script><!-- Served in 0.063 secs. -->
	</body>
<!-- Cached 20200313074001 -->
</html>